package com.jp.knowledge.fragment;


import android.os.Bundle;
import android.support.annotation.Nullable;

import com.google.gson.JsonObject;
import com.jiayen.cache.FileCacheManager;
import com.jp.knowledge.http.HttpHelper;

/**
 * Created by 528787067@qq.com on 2017/6/15.
 */

public class TeamDocFragment extends VipZoneFragment{

	public static TeamDocFragment newInstance(String id, String companyId){
		TeamDocFragment fragment = new TeamDocFragment();
		Bundle bundle = new Bundle();
		bundle.putString("id", id);
		bundle.putString("companyId", companyId);
		fragment.setArguments(bundle);
		return fragment;
	}

	private String companyId;

	public String getCompanyId() {
		return companyId;
	}

	@Override
	@Deprecated
	public String getPackageId() {
		return getCompanyId();
	}

	@Override
	public void onCreate(@Nullable Bundle savedInstanceState) {
		companyId = getArguments().getString("companyId");
		super.onCreate(savedInstanceState);
	}

	@Override
	protected void initCache() {
		cacheManager = new FileCacheManager();
		cachePath = mContext.getCacheDir() + "/teamDoc_" + companyId + ".dat";
	}

	@Override
	protected void getData(int page){
		JsonObject param  = new JsonObject();
		param.addProperty("companyId", companyId);
		param.addProperty("page", page);
		HttpHelper.getInstance(mContext).knowledgePackage(param, page, this);
	}
}
